﻿@model IEnumerable<Stardust.Models.UsuarioViewModelList>

@{
    ViewBag.Title = "Usuarios";
}

@if (Html.ValidationSummary() != null)
{
<div class="nNote nWarning hideit">
    <p>@Html.ValidationSummary()</p>
</div>
}

<br />
<h2>@ViewBag.Title</h2>

<p>
    <a href="@Url.Action("Create")"><img src="@Url.Content("~/Content/images/icons/color/plus.png")" alt="Create" />Añadir usuario</a>
</p>

<div class="wrapper">
    <div class="widget">
        <div class="title">
            <img src="@Url.Content("~/Content/images/icons/dark/list.png")" alt class="titleIcon">
            <h6>@ViewBag.Title</h6>
        </div>
        <div class="dataTables_wrapper">
            <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable">
                <thead>
                    <tr>
                        <th class="ui-state-default" rowspan="1" colspan="1" style="width:170px;" >
                            <div class="DataTables_sort_wrapper">
                            Usuario
                            <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                            </div>
                        </th>
                        <th class="ui-state-default" rowspan="1" colspan="1" style="width:170px;" >
                            <div class="DataTables_sort_wrapper">
                            E-mail
                            <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                            </div>
                        </th>
                        <th class="ui-state-default" rowspan="1" colspan="1" style="width:170px;" >
                            <div class="DataTables_sort_wrapper">
                            Perfil de usuario
                            <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                            </div>
                        </th>
                        <th class="ui-state-default" rowspan="1" colspan="1" style="width:170px;" >
                            <div class="DataTables_sort_wrapper">
                            Estado
                            <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                            </div>
                        </th>
                        <th class="ui-state-default" rowspan="1" colspan="1" style="width:300px;" >
                            <div class="DataTables_sort_wrapper">
                            Opciones
                            <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                            </div>
                        </th>
                    </tr>
                </thead>

                <tbody>
                @foreach (var item in Model)
                {
                    <tr class="gradeA odd">
                        <td>@Html.DisplayFor(modelItem => item.user_account )</td>
                        <td>@Html.DisplayFor(modelItem => item.email )</td>
                        <td>@Html.DisplayFor(modelItem => item.nombrePerfilUsuario )</td>
                        <td>@Html.DisplayFor(modelItem => item.estado )</td>
                        <td>
                            <a href="@Url.Action("Edit", new { id = item.ID })"><img src="@Url.Content("~/Content/images/icons/color/pencil.png")" alt="Edit" />Editar </a> | 
                            <a href="@Url.Action("Details", new { id = item.ID })"><img src="@Url.Content("~/Content/images/icons/color/edit-column.png")" alt="Details" />Detalles</a> | 
                            @*<a  id = @item.ID class = "eliminar" href=""><img src="../../Content/images/icons/color/cross.png", alt="Delete" />Borrar</a> |*@
                            <a href="@Url.Action("Delete", new { id = item.ID })"><img src="@Url.Content("~/Content/images/icons/color/cross.png")" alt="Delete" />Borrar</a>
                        </td>
                    </tr>
                }
                </tbody>
            </table>
        </div>
    </div>
</div>

@*<div id="dialogEliminar" title="Desea Eliminar el ?">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>
El usuario QUE UD. Elimine ya no podra ser recuperado nunca mas en la vidaaa natural </p>
</div>*@

@*<script type = "text/javascript">
        var idEliminar = 0;
        $(".eliminar").click(function () {
            //Jp++ GPL version xD
            $('#dialogEliminar').dialog('open');
            idEliminar = $(this).attr("id");
            return false;
        });

        $('#dialogEliminar').dialog({
            autoOpen: false,
            resizable: false,
            draggable: false,
            width: 300,
            modal: true,
            title: "!Confirmar Eliminacion del Empleado",
            position: "center",
            buttons: {
                "Aceptar": function () {
                    $.ajax({
                        type: "POST",
                        dataType: "json",
                        contentType: "application/json; charset=utf-8",
                        url: "Delete/" + idEliminar,
                        success: function (data) {
                            //oTable.fnDraw(false);
                            if (data.me == "") {
                                $(this).dialog("close");
                                location.reload();
                            }
                        }
                    });

                },
                "Cancelar": function () {
                    $(this).dialog("close");
                    return false;
                }
            }
        });

</script>*@
